import {ADD} from './mutation-types'
const mutations = {
  [ADD](state) {
    state.num ++
  },
  de(state) {
    state.num --
  },
  // payload是载荷，用户传递的数据
  charge(state, payload) {
    debugger
    // console.log(state);
    // console.log(payload); 
    if(payload.type === "CNY") {
      state.num += Number(payload.num)
    }else if(payload.type === "USD") {
      state.num += Number(payload.num) * 6.5
    }
  },
  chargeObj(state, payload) {
    // console.log(state);
    // console.log(payload); 
    if(payload.type1 === "CNY") {
      state.num += Number(payload.num)
    }else if(payload.type1 === "USD") {
      state.num += Number(payload.num) * 6.5
    }
  }
}

export default mutations